/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.epos.datalogic.define.dao.sale;

import cn.ekuma.data.dao.InfoDAO;
import com.openbravo.data.basic.BasicException;
import com.openbravo.data.loader.DataRead;
import com.openbravo.data.loader.SerializerWriteString;
import com.openbravo.data.loader.StaticSentence;
import com.openbravo.bean.sales.SharedTicketInfo;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class ShardTicketInfoDAO extends InfoDAO<SharedTicketInfo,ShardTicketDAO>{

    public ShardTicketInfoDAO(ShardTicketDAO base) {
        super(base,new int[]{0,1,3,4,5,6});
    }

   
    public SharedTicketInfo readValues(DataRead dr,SharedTicketInfo obj) throws BasicException {
        if(obj==null)
        	obj=new SharedTicketInfo();
        obj.setId(dr.getString(1));
        obj.setName(dr.getString(2));
        obj.setM_sGroupName(dr.getString(3));
        obj.setLocationId(dr.getString(4));
        obj.setLocked(dr.getBoolean(5));
        obj.setLockUserId(dr.getString(6));
    	return obj;
    }

    @Override
    public Class getSuportClass() {
       return SharedTicketInfo.class;
    }

     public final List<SharedTicketInfo> getSharedTicketList(String locationId) throws BasicException {
        return (List<SharedTicketInfo>) new StaticSentence(s
                ,this.getListSQL()+ " WHERE LOCATIONREF=? AND LOCKED="+s.getDB().FALSE()+" ORDER BY ID"
                , SerializerWriteString.INSTANCE
                , this).list(locationId);
    }


}
